<?php

namespace Data\Drive;

class ToQuerySql
{
    public static function Run($sql)
    {
        $strSql = isset($sql['sql']) ? $sql['sql'] : "SELECT {$sql['field']} FROM {$sql['table']}";
        isset($sql['where']) && $strSql .= " WHERE {$sql['where']}";
        isset($sql['group']) && $strSql .= " GROUP BY {$sql['group']}";
        isset($sql['order']) && $strSql .= " ORDER BY {$sql['order']}";
        isset($sql['limit']) && $strSql .= " LIMIT {$sql['limit']}";
        return $strSql;
    }
}
